<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ page isELIgnored="false"%>
<%
    String path = request.getContextPath();
%>
<!DOCTYPE html>
<html>
<head>

<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">


<title>李宁体育管理系统</title>

<link rel="shortcut icon" href="favicon.ico">
<link href="<%=path%>/css/bootstrap.min14ed.css?v=3.3.6"
	rel="stylesheet">
<link href="<%=path%>/css/font-awesome.min93e3.css?v=4.4.0"
	rel="stylesheet">
<link href="<%=path%>/css/style.min862f.css?v=4.1.0" rel="stylesheet">
<link href="<%=path%>/css/plugins/chosen/chosen.css" rel="stylesheet">

<link
	href="<%=path%>/css/plugins/awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css"
	rel="stylesheet">
<link href="<%=path%>/css/animate.min.css" rel="stylesheet">

</head>

<body class="gray-bg ">
	<div class="wrapper wrapper-content animated fadeInRight">
		<div class="row">
			<div class="col-sm-12">
				<div class="ibox float-e-margins">
					<c:forEach items="${tag }" var="g" varStatus="i">
						<c:if test="${i.count%4==1 }">
							<div class="ibox-content" style="margin: 5px">
								<ul class="tag-list" style="padding: 0">
						</c:if>
						<li class="col-sm-3">
							<div class="checkbox checkbox-warning checkbox-inline ">
								<input type="checkbox" id="inlineCheckbox${i.count }" value="${g.id }">
								<label for="inlineCheckbox${i.count }"><a style="margin: -3px"
									><i class="fa fa-tag"></i> ${g.tagName }</a></label>
							</div>
						</li>
				<c:if test="${i.count%4==0 }">
							</ul>
				</div>
				</c:if>
				</c:forEach>
				</ul>
				</div>
				<div class="form-group" >
					<p style="margin-bottom: 25%">
						<span id="msgTip" style="color: red"></span>
					     <button class="btn btn-success pull-right" style="margin-left: 3px" type="button"
							onclick="goback()">
							<i class="fa fa-reply"></i> 返回
						</button>
						<button class="btn btn-primary pull-right" style="margin-left: 3px" type="button"
							onclick="saveTag()">
							<i class="fa fa-check"></i>&nbsp;删除
						</button>
						
					</p>
				</div>
			</div>
		</div>
	</div>
	</div>
	<script src="<%=path%>/js/jquery.min.js?v=2.1.4"></script>
	<script src="<%=path%>/js/bootstrap.min.js"></script>
	<script src="<%=path%>/js/plugins/layer/layer.js"></script>
	<script type="text/javascript">
	var goback=function(){
		var index=parent.layer.getFrameIndex(window.name);

		parent.layer.close(index);
	}
	var saveTag=function(){
		var list=[];
		 <c:forEach items="${tag }" var="electVar">
		list.push("${electVar['tagName']}");
		</c:forEach> 
		
		var tagId=[];
		for(var i=0;i<=list.length;i++){
		if($('#inlineCheckbox'+i+'').is(':checked')) {
			var id=$('#inlineCheckbox'+i+'').val();
			tagId.push(id);
			}
		}
		jQuery.ajax({
			type: "post",
		    url: "<%=path%>/weixin/toDeleteTagForCust",
		    dataType: "json",
		    data: {"tagId":tagId,"userId":${id}},
		    beforeSend:function() {
		    	$("#progress").modal();
		    	$("#loading").html("正在用户标签数据，请稍候...");

		    },
		    complete:function(data) {
		    	$("#progress").modal('hide');
		    	$("#loading").html("");
		    }, 
		    success: function (data) {
		    	if(data.status==200){
		    		parent.layer.msg("保存标签数据信息成功!",{time: 500},function(){goback();});
		    	}else{
		    		$("#msgTip").html(data.msg);		    		
		    	}
		    },
		    error: function () {
		    	parent.layer.msg("请选择标签!");
		    }	
		});
	}
	
	</script>
</body>
</html>
